package model.base;

import java.util.ArrayList;

import model.algorithm.AStar;
import model.algorithm.Action;
import model.algorithm.Bfs;
import model.algorithm.SearchDomain;
import model.algorithm.Searcher;
import model.domain.Puzzle8Domain;
import model.domain.Puzzle8DomainHeuris;


public class Test {

		public static void main(String[] args) {			
			
	
			// 8 Puzzle Game Check for BFS
			SearchDomain bfsDomain=new Puzzle8Domain("123456708");	
			Searcher s = new Bfs();
			long startTime = System.currentTimeMillis();
			ArrayList<Action> actions = s.search(bfsDomain);
			long endTime = System.currentTimeMillis();
			System.out.println("BFS 8-Puzzle --- Those are the right steps");
			for(Action a : actions)
				System.out.println(a);
			System.out.println("\nthe time is: "+(endTime-startTime) + " MilliSec'");
			
			
			System.out.println("\n======================================\n");
			
			
			// 8 Puzzle Check for A Star
			SearchDomain aStarDomain=new Puzzle8Domain("103425786");
			Puzzle8DomainHeuris hu = new Puzzle8DomainHeuris();
			Searcher s2 = new AStar(hu);
			long startTime2 = System.currentTimeMillis();
			ArrayList<Action> actions2 = s2.search(aStarDomain);
			long endTime2 = System.currentTimeMillis();
			System.out.println("A Star 8-Puzzle --- Those are the right steps:");
			for(Action a : actions2)
				System.out.println(a);
			System.out.println("\nthe time is: "+(endTime2-startTime2) + " MilliSec'");
			
		}

}
